package com.example.activitydemo

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.TextView
import androidx.activity.ComponentActivity

/**
 *@author: njb
 *@date:  2023/3/13 17:24
 *@desc:
 */
class ActivityC :ComponentActivity(){
    private val TAG = "ActivityC生命周期"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_c)
        val tvTest: TextView = findViewById(R.id.tv_test_c)
        tvTest.setOnClickListener {
            val intent = Intent(ActivityC@this,ActivityD::class.java)
            startActivity(intent)
        }
    }

    override fun onRestart() {
        super.onRestart()
        Log.d(TAG,"--onRestart-"+"---ActivityC重新创建了---")
    }

    override fun onResume() {
        super.onResume()
        Log.d(TAG,"--onResume--"+"---ActivityC已经可见了---")
    }

    override fun onStart() {
        super.onStart()
        Log.d(TAG,"--onStart--"+"---ActivityC已经启动了---")
    }

    override fun onPause() {
        super.onPause()
        Log.d(TAG,"--onPause--"+"---ActivityC已经暂停了---")
    }

    override fun onStop() {
        super.onStop()
        Log.d(TAG,"--onStop--"+"---ActivityC已经停止了---")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(TAG,"--onDestroy--"+"---ActivityC已经销毁了---")
    }
}